/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package simframe.simulation;

/**
 *
 * @author Steve Noble
 */
public class SimParameter {

    public interface Method {
        void update( double val);
    }

    public SimParameter(String name, String desc, String group, Method method) {
        this.name = name;
        this.desc = desc;
        this.method = method;
        this.group = group;

         range = new Range();
         range.setMinMax(0, 1);
    }

    public String getName() {
        return name;
    }

    public String getDescription() {
        return desc;
    }

    public void setRange(double min, double max) {
        range.setMinMax(min, max);
    }

    public Range getRange() {
        return range;
    }

    public String getGroup() {
        return group;
    }

    public void update(double inVal) {
        method.update(map(inVal));
    }

    public double map(double inVal) {
        return range.invMap(inVal, 0, 100);
    }
    
    private final Range range;
    private final String name;
    private final String desc;
    private final Method method;
    private final String group;
}